package cn.didi.feidi.javabackend.mysql.jpa.controller;

import cn.didi.feidi.javabackend.mysql.jpa.repository.WaterDeToRep;
import cn.didi.feidi.javabackend.mysql.jpa.waterDeliver.WaterDeTo;
import cn.didi.feidi.javabackend.mysql.jpa.waterDeliver.WaterDeliver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sun.misc.Request;

/**
 * Created by lindanpeng on 2017/7/17.
 */
@RestController
@RequestMapping("WaterDeTo")
public class WaterDeToController {
    @Autowired
    WaterDeToRep waterDeToRep;
    @RequestMapping(value="getByWaterDeliverId",method = RequestMethod.GET)
    public WaterDeTo getByWaterDeliverId(String waterDeliverId){
        return waterDeToRep.findByWaterDeliverId(waterDeliverId);
    }
    @RequestMapping(value="add",method= RequestMethod.POST)
    public void add(@RequestBody  WaterDeTo waterDeTo){
        waterDeToRep.save(waterDeTo);
    }
    @RequestMapping(value="update",method = RequestMethod.POST)
    public void update(@RequestBody WaterDeTo waterDeTo){
        waterDeToRep.save(waterDeTo);
    }
}
